home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / mlang.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  7.1 KB  |  203 lines

  1. *mlang.txt*     For Vim version 6.0.  Last change: 2001 Sep 04
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Multi-language features                *multilang* *multi-lang*
  8.  
  9. This is about using messages and menus in various languages.  For editing
  10. multi-byte text see |multibyte|.
  11.  
  12. The basics are explained in the user manual: |usr_45.txt|.
  13.  
  14. 1. Messages            |multilang-messages|
  15. 2. Menus            |multilang-menus|
  16. 3. Scripts            |multilang-scripts|
  17.  
  18. {Vi does not have any of these features}
  19. {not available when compiled without the |+multi_lang| feature}
  20.  
  21. ==============================================================================
  22. 1. Messages                        *multilang-messages*
  23.  
  24. Vim picks up the locale from the environment.  In most cases this means Vim
  25. will use the language that you prefer, unless it's not available.
  26.  
  27. To see a list of supported locale names on your system, look in one of these
  28. directories (for Unix):
  29.     /usr/lib/locale ~
  30.     /usr/share/locale ~
  31. Unfortunately, upper/lowercase differences matter.  Also watch out for the
  32. use of "-" and "_".
  33.  
  34.                         *:lan* *:lang* *:language* *E197*
  35. :lan[guage]
  36. :lan[guage] mes[sages]
  37. :lan[guage] cty[pe]
  38. :lan[guage] tim[e]
  39.             Print the current language (aka locale).
  40.             With the "messages" argument the language used for
  41.             messages is printed.  Technical: LC_MESSAGES.
  42.             With the "ctype" argument the language used for
  43.             character encoding is printed.  Technical: LC_CTYPE.
  44.             With the "time" argument the language used for
  45.             strftime() is printed.  Technical: LC_TIME.
  46.             Without argument all parts of the locale are printed
  47.             (this is system dependend).
  48.             The current language can also be obtained with the
  49.             |v:lang|, |v:ctype| and |v:lc_time| variables.
  50.  
  51. :lan[guage] {name}
  52. :lan[guage] mes[sages] {name}
  53. :lan[guage] cty[pe] {name}
  54. :lan[guage] tim[e] {name}
  55.             Set the current language (aka locale) to {name}.
  56.             The locale {name} must be a valid locale on your
  57.             system.  Some systems accept aliases like "en" or
  58.             "en_US", but some only accept the full specification
  59.             like "en_US.ISO_8859-1".
  60.             With the "messages" argument the language used for
  61.             messages is set.  This can be different when you want,
  62.             for example, English messages while editing Japanese
  63.             text.  This sets $LC_MESSAGES.
  64.             With the "ctype" argument the language used for
  65.             character encoding is set.  This affects the libraries
  66.             that Vim was linked with.  It's unusual to set this to
  67.             a different value from 'encoding'.  This sets
  68.             $LC_CTYPE.
  69.             With the "time" argument the language used for time
  70.             and date messages is set.  This affects strftime().
  71.             This sets $LC_TIME.
  72.             Without an argument both are set, and additionally
  73.             $LANG is set.
  74.             This will make a difference for items that depend on
  75.             the language (some messages, time and date format).
  76.             Not fully supported on all systems
  77.             If this fails there will be an error message.  If it
  78.             succeeds there is no message.  Example: >
  79.                 :language
  80.                 Current language: C
  81.                 :language de_DE.ISO_8859-1
  82.                 :language mes
  83.                 Current messages language: de_DE.ISO_8859-1
  84.                 :lang mes en
  85. <
  86.  
  87. MS-WINDOWS MESSAGE TRANSLATIONS                *win32-gettext*
  88.  
  89. If you used the self-installing .exe file, message translations should work
  90. already.  Otherwise get the libintl.dll file if you don't have it yet:
  91.  
  92.     http://sourceforge.net/projects/gettext
  93.  
  94. This also contains tools xgettext, msgformat and others.
  95.  
  96. libintl.dll should be placed in same directory with (g)vim.exe, or some
  97. place where PATH environment value describe.  Message files (vim.mo)
  98. have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the
  99. abbreviation of the language (mostly two letters).
  100.  
  101. If you write your own translations you need to generate the .po file and
  102. convert it to a .mo file.  You need to get the source distribution and read
  103. the file "src/po/README.txt".
  104.  
  105. To overrule the automatic choice of the language, set the $LANG variable to
  106. the language of your choice.  use "en" to disable translations. >
  107.  
  108.   :let $LANG = 'ja'
  109.  
  110. (text for Windows by Muraoka Taro)
  111.  
  112. ==============================================================================
  113. 2. Menus                        *multilang-menus*
  114.  
  115. See |45.2| for the basics.
  116.  
  117. Note that if changes have been made to the menus after the translation was
  118. done, some of the menus may be shown in English.  Please try contacting the
  119. maintainer of the translation and ask him to update it.  You can find the
  120. name and e-mail address of the translator in
  121. "$VIMRUNTIME/lang/menu_<lang>.vim".
  122.  
  123. To set the font (or fontset) to use for the menus, use the |:highlight|
  124. command.  Example: >
  125.  
  126.     :highlight Menu font=k12,r12
  127.  
  128.  
  129. ALIAS LOCALE NAMES
  130.  
  131. Unfortunately, the locale names are different on various systems, even though
  132. they are for the same language and encoding.  If you do not get the menu
  133. translations you expected, check the output of this command: >
  134.  
  135.     echo v:lang
  136.  
  137. Now check the "$VIMRUNTIME/lang" directory for menu translation files that use
  138. a similar language.  A difference in a "-" being a "_" already causes a file
  139. not to be found!  Another common difference to watch out for is "iso8859-1"
  140. versus "iso_8859-1".  Fortunately Vim makes all names lowercase, thus you
  141. don't have to worry about case differences.  Spaces are changed to
  142. underscores, to avoid having to escape them.
  143.  
  144. If you find a menu translation file for your language with a different name,
  145. create a file in your own runtime directory to load that one.  The name of
  146. that file could be: >
  147.  
  148.     ~/.vim/lang/menu_<v:lang>.vim
  149.  
  150. Check the 'runtimepath' option for directories which are searched.  In that
  151. file put a command to load the menu file with the other name: >
  152.  
  153.     runtime lang/menu_<other_lang>.vim
  154.  
  155.  
  156. TRANSLATING MENUS
  157.  
  158. If you want to do your own translations, you can use the |:menutrans| command,
  159. explained below.  It is recommended to put the translations for one language
  160. in a Vim script.  For a language that has no translation yet, please consider
  161. becoming the maintainer and make your translations available to all Vim users.
  162. Send an e-mail to the Vim maintainer <maintainer@vim.org>.
  163.  
  164.                     *:menut* *:menutrans* *:menutranslate*
  165. :menut[ranslate] clear
  166.             Clear all menu translations.
  167.  
  168. :menut[ranslate] {english} {mylang}
  169.             Translate menu name {english} to {mylang}.  All
  170.             special characters like "&" and "<Tab>" need to be
  171.             included.  Spaces and dots need to be escaped with a
  172.             backslash, just like in other |:menu| commands.
  173.  
  174. See the $VIMRUNTIME/lang directory for examples.
  175.  
  176. To try out your translations you first have to remove all menus.  This is how
  177. you can do it without restarting Vim: >
  178.     :source $VIMRUNTIME/delmenu.vim
  179.     :source <your-new-menu-file>
  180.     :source $VIMRUNTIME/menu.vim
  181.  
  182. Each part of a menu path is translated separately.  The result is that
  183. "Help.Overview" will be translated to "Hilfe.Überblick".
  184.  
  185. ==============================================================================
  186. 3. Scripts                        *multilang-scripts*
  187.  
  188. In Vim scripts you can use the |v:lang| variable to get the current language
  189. (locale).  The default value is "C" or comes from the $LANG environment
  190. variable.
  191.  
  192. The following example shows how this variable is used in a simple way, to make
  193. a message adapt to language preferences of the user, >
  194.  
  195.     :if v:lang =~ "de_DE"
  196.     :  echo "Guten Morgen"
  197.     :else
  198.     :  echo "Good morning"
  199.     :endif
  200. <
  201.  
  202.  vim:tw=78:sw=4:ts=8:ft=help:norl:
  203.